package com.ywd.materials.admin.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.ywd.materials.admin.dto.query.MaterialsGoodsPkgQuery;
import com.ywd.materials.admin.entity.MaterialsGoodsPkgEntity;
import com.ywd.materials.admin.exception.RPage;
import com.ywd.materials.admin.mapper.MaterialsGoodsPkgMapper;
import com.ywd.materials.admin.vo.MaterialsGoodsPkgVo;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * YWD
 * 2025/11/14
 */
@AllArgsConstructor
@Service
public class MaterialsGoodsPkgServiceImpl extends ServiceImpl<MaterialsGoodsPkgMapper, MaterialsGoodsPkgEntity> {


    public RPage<List<MaterialsGoodsPkgVo>> getGoodsPkgPage(MaterialsGoodsPkgQuery query) {
        Page<Object> page = PageHelper.startPage(query.getPage(), query.getLimit());
        List<MaterialsGoodsPkgVo> list =  this.baseMapper.getGoodsPkgPage(query);
        return RPage.ok(list,query.getPage(),query.getLimit(),page.getTotal());
    }

}
